#include <button.h>

namespace lgb_gtk
{

  int Button::AddMouseOverFunction(int (*f)(void *data), void *data)
  {
    if(NULL == f)
      return 1;

    mouseOverFunctions[f] = data;
    return 0;
  }

  int Button::MouseOverBaseFunction()
  {
    map<int (*)(void *) , void*>::iterator it = mouseOverFunctions.begin();
    while( it != mouseOverFunctions.end() )
      {
	it->first(it->second);
	it++;
      }
      
    return 0;
  }

  int Button::AddMouseDownFunction(int (*f)(void *data), void *data)
  {
    if(NULL == f)
      return 1;

    mouseDownFunctions[f] = data;
    return 0;
  }

  int Button::MouseDownBaseFunction()
  {
    map<int (*)(void *) , void*>::iterator it = mouseDownFunctions.begin();
    while( it != mouseDownFunctions.end() )
      {
	it->first(it->second);
        it++;
      }

    return 0;
  }

  int Button::AddMouseOutFunction(int (*f)(void *data), void *data)
  {
    if(NULL == f)
      return 1;

    mouseOutFunctions[f] = data;
    return 0;
  }

  int Button::MouseOutBaseFunction()
  {
    map<int (*)(void *) , void*>::iterator it = mouseOutFunctions.begin();
    while( it != mouseOutFunctions.end() )
      {
        it->first(it->second);
        it++;
      }

    return 0;
  }

}
